#include <bits/stdc++.h>
using namespace std;

struct nums_{
    int idx;
    int h;
    bool operator <(nums_ other){
        return h<other.h;
    }
};

int main(int argc, char* argv[]){
    int base_sz, water_sz;
    cin>>base_sz;
    vector<nums_> base_h(base_sz+2);
    for(int i=1; i<=base_sz; i++){
        cin>>base_h[i].h;
        base_h[i].idx = i;
    }
    cin>>water_sz;
    vector<nums_> water_h(water_sz);
    for(int i=0; i<water_sz; i++){
        cin>>water_h[i].h;
        water_h[i].idx = i;
    }
    vector<int> sink(base_sz+2, 0);  //标志发电机是否被淹没（未排序）
    vector<int> ans(water_sz);

    sink[0] = sink.back() = 1;
    sort(base_h.begin()+1, base_h.end()-1);
    sort(water_h.begin(), water_h.end());

    int curr_base = 1, curr_ans=1;   
    for(int i=0; i<water_sz; i++){  //遍历每次洪水（排序后）
        //遍历每个发电机站（排序后） 
        while(curr_base<=base_sz && base_h[curr_base].h<=water_h[i].h){
            //当前遍历到的发电机站高度小于洪水高度，被淹了
            int idx = base_h[curr_base].idx;
            sink[idx] = 1;
            int adj = sink[idx-1]+sink[idx+1];
            if(adj == 0) curr_ans++;
            else if(adj == 2) curr_ans--;
            curr_base++;
        }
        ans[water_h[i].idx] = curr_ans;
    }
    for(int i=1; i<=water_sz; i++){
        cout<<ans[i]<<endl;
    }
   

    return 0;
}